#include <iostream>
using namespace std;

int main()
{
	long x, y;
	cin >> x >> y;
	if(y % x != 0)
		cout << y - x << endl;
	else if(y % x == 0)
		cout << y + x << endl;
	return 0;
} 
